/*
 * BucketEntry.java
 * classes : com.ruint.lib.mediachooser.core.BucketEntry
 * @author ruint
 * V 1.0.0
 * Create at 2014-12-4 下午3:02:23
 */
package com.ruint.lib.mediachooser.core;

import com.ruint.core.bean.BaseBean;

/**
 * com.ruint.lib.mediachooser.core.BucketEntry
 * 
 * @author ruint <br/>
 *         create at 2014-12-4 下午3:02:23
 */
public class BucketEntry extends BaseBean {

  private static final long serialVersionUID = 1L;

  private String bucketName;
  private int bucketId;
  private String bucketUrl;

  public BucketEntry(int id, String name, String url) {
    bucketId = id;
    bucketName = ensureNotNull(name);
    bucketUrl = url;
  }

  public String getBucketName() {
    return this.bucketName;
  }

  public void setBucketName(String bucketName) {
    this.bucketName = bucketName;
  }

  public int getBucketId() {
    return this.bucketId;
  }

  public void setBucketId(int bucketId) {
    this.bucketId = bucketId;
  }

  public String getBucketUrl() {
    return this.bucketUrl;
  }

  public void setBucketUrl(String bucketUrl) {
    this.bucketUrl = bucketUrl;
  }

  @Override
  public int hashCode() {
    return bucketId;
  }

  @Override
  public boolean equals(Object object) {
    if (!(object instanceof BucketEntry))
      return false;
    BucketEntry entry = (BucketEntry) object;
    return bucketId == entry.bucketId;
  }

  public static String ensureNotNull(String value) {
    return value == null ? "" : value;
  }
}
